package com.sc.nft.admin.controller;

import com.sc.nft.admin.request.IdRequest;
import com.sc.nft.admin.request.StatusRequest;
import com.sc.nft.annotation.SysMemberLogin;
import com.sc.nft.service.EcologyHatchUsePropsExchangeService;
import com.sc.nft.sup.PageResult;
import com.sc.nft.sup.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @author 朱梦晨
 * @Description:
 * @date 2024-08-09
 */
@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("/admin/ecologyHatch/propsExchange")
@Api("兑换熔炼上限所关联道具卡")
public class EcologyHatchUsePropsExchangeController {

    private final EcologyHatchUsePropsExchangeService ecologyHatchUsePropsExchangeService;


    @PostMapping(value = "/updateStatus", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "更新兑换生态熔炼上限关联道具卡状态", notes = "更新兑换生态熔炼上限关联道具卡状态", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @SysMemberLogin
    public Result updateStatus(@Valid @RequestBody StatusRequest request) {
        ecologyHatchUsePropsExchangeService.updateStatus(request.getId(),request.getStatus());
        return PageResult.success();
    }



    @PostMapping(value = "/dealExchangeUseProps", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "删除兑换生态熔炼上限关联道具卡", notes = "兑换铸造上限", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @SysMemberLogin
    public Result dealExchangeUseProps(@Valid @RequestBody IdRequest request) {
        ecologyHatchUsePropsExchangeService.dealExchangeUsePropsById(request.getId());
        return Result.success();
    }

}
